<%--
  Created by IntelliJ IDEA.
  User: zhangjie
  Date: 2019/4/24
  Time: 4:06 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<%@ include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
<html>
<head>
    <title>骨松信息修改页面</title>
    <link rel="stylesheet" href="${frames}/css/lib/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="${frames}/css/lib/dataTables.bootstrap.css" type="text/css">
    <%--<link rel="stylesheet" href="${frames}/css/paginate.css" type="text/css">--%>
    <%--<link rel="stylesheet" href="${frames}/css/qulitity.css" type="text/css">--%>
    <link rel="stylesheet" href="../assets/css/views/modules/_common.scss">
    <link rel="stylesheet" href="${newframe}/css/base/base.css" type="text/css">
    <link rel="stylesheet" href="${assets}/css/views/bloodScreening.css">
    <link rel="stylesheet" href="${assets}/css/views/department/departmentMgr.css">
    <script src="../assets/js/views/vue.min.js"></script>
    <script src="${js}/jquery-1.9.1.min.js"></script>
    <script src="${js}/jquery.dataTables.js"></script>
    <link href="../assets/css/bootstrap-datetimepicker.css" type="text/css">
    <script src="../assets/js/bootstrap-datetimepicker.min.js"></script>
    <script src="${frames}/Chronic/laydate/laydate.js"></script>
    <script src="${assets}/js/views/bpAbnormal.js"></script>
    <%@ include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
    <style>
        .color{
            margin:0 !important;
        }
        span{
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            font-family: PingFang-SC-Regular;
        }
        .illness span{
            height: 16px;
            font-family: PingFang-SC-Regular;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #666666;
        }
        .btn{
            float:right ;
            width:100px;
            font-size:16px;
            line-height:28px;
            background:#35acfd !important;
            margin-right:15px !important;
            padding:0 !important;
        }
        .title{
            font-family: MicrosoftYaHei;
            font-size: 16px !important;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0.3px;
            color: #666666;
        }
        label{
            height: 16px;
            font-family: PingFang-SC-Regular;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #666666;
        }
        /* 随访时间及方式 */
        .way,illness,sign,live,evaluate{
            margin-bottom:30px;
        }
        .way_content,illness_content{
            width:100%;
            margin-left:15px;
            margin-top:19px;
        }
        .way_content label{
            width:auto;
        }
        .way_content div{
            margin-bottom:20px;
        }
        .way_content input,#accompanyType{
            width: 181px;
            line-height: 30px;
            height:30px;
            border: solid 1px #d0d0d0;
            font-family: MicrosoftYaHei;
            font-size: 14px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #333333;
            text-indent:10px !important;
        }
        /* 病症 */
        .illness_content{
            margin-left:15px;
            margin-bottom:20px;
        }
        .illness_content label{
            margin-left:22px;
        }
        input[type=checkbox] {
            width:20px;
            height:20px;
            -webkit-appearance: none;
            border-radius:5px;
            border:1px solid #9e9e9e;
            vertical-align:top;
            margin-top:7px;
            display:inline-block !important;
        }
        input[type=checkbox]:checked{
            background-image: url('../assets/images/radio.png');
            background-size:100% 100%;
            border:none
        }
        .ill1{
            margin-right:22px;
            margin-top:20px;
        }
        /* 体征 */
        .sign_content{
            margin-left:15px;
            margin-top:20px;
            margin-bottom:20px;
        }
        .sign_content div input{
            width:180px;
            line-height: 30px;
            border: solid 1px #d0d0d0;
            text-indent:10px;
            position:absolute;
            height:30px;
            display:inline-block;
        }
        .sign_content div span{
            position:relative;
            left:130px;
        }
        .sign_content div{
            display:inline-block;
            width:270px;
        }
        .second div input{
            width:135px;
        }
        .second div span{
            left:80px;
        }
        /*.second div{*/
        /*width:230px;*/
        /*}*/
        .third div input{
            width:135px;
        }
        .third div span{
            left:80px;
        }
        .third div{
            width:200px;
        }
        /* 生活方式调查 */
        .live_content{
            margin-left:15px;
            margin-top:20px;
        }
        .live_content span{
            font-family: PingFang-SC-Regular;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #666666;
            margin-right:19px;
            display:inline-block;
        }
        .live_content input{
            width: 115px;
            height: 30px;
            border: solid 1px #d0d0d0;
            line-height:30px;
            margin-right:10px;
            text-indent:10px;
        }
        .live_content div{
            margin-top:20px;
        }
        .sprots span{
            margin-right:65px;
        }
        #salt{
            width: 15%;
            height: 30px;
            border: solid 1px #d0d0d0;
            font-family: MicrosoftYaHei;
            font-size: 15px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #333333;
            text-indent:10px;
            margin-right:19px;
        }
        .salt input{
            width: 180px;
            height: 30px;
            border: solid 1px #d0d0d0;
            line-height:30px;
            margin-right:10px;
            text-indent:10px;
        }
        .mentality{
            margin-bottom:20px;
        }
        select{
            width: 181px;
            height: 30px;
            border: solid 1px #d0d0d0;
            font-family: MicrosoftYaHei;
            font-size: 15px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #333333;
            text-indent:10px;
        }
        .salttype{
            width: 200px;
            height: 30px;
        }
        /* 随访评估 */
        .evaluate_content{
            margin-left:15px;
            margin-bottom:20px;
            margin-top:20px;
        }
        .evaluate_content span{
            font-family: PingFang-SC-Regular;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #666666;
            margin-right:19px;
            display:inline-block;
        }
        /* 治疗建议 */
        .suggest_content{
            margin-left:15px;
            margin-bottom:20px;
            margin-top:20px;
        }
        .suggest_content span{
            font-family: PingFang-SC-Regular;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #666666;
            margin-right:19px;
            display:inline-block;
        }
        .suggest_content textarea{
            width: 500px;
            height: 120px;
            border: solid 1px #d0d0d0;
            vertical-align:top
        }
        #main{
            margin-top:0px !important;
        }
        /*  表格 */
        #example th{
            height: 30px;
            background-color: #e6e6e6;
            font-family: MicrosoftYaHei;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #666666;
        }
        #example td{
            text-align:center;
            height: 17px;
            font-family: MicrosoftYaHei;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #333333;
        }
        #mytool{
            width:96%;
        }
        #example_paginate{
            margin-top:15px;
            width:100%;
            text-align: center;
            margin-bottom:40px;
        }
        button{
            margin-top:0px !important;
        }
        .btn{
            font-family: MicrosoftYaHei;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0.3px;
            color: #ffffff;
        }
        textarea{
            font-family: MicrosoftYaHei;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #333333;
            text-indent:10px;
        }
        input{
            text-indent:10px;
            font-family: MicrosoftYaHei;
            font-size: 14px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #333333;
        }
        .content{
            height:auto !important;
        }
        .illness{
            box-shadow:none !important;
            margin-top:0 !important;
            padding-top:20px;
        }
        .dataTables_empty{
            line-height:30px;
        }
        .default{
            border:1px solid red !important;
        }
        input{
            display:inline-block !important;
        }
        .warn{
            padding:30px;
            width:90% !important;
            background:#e6e6e6;
        }
        .warn ul li{
            font-family: MicrosoftYaHei;
            font-size: 16px;
            font-weight: normal;
            font-stretch: normal;
            line-height: 30px;
            letter-spacing: 0px;
            color: #333333;
            text-indent:10px;
        }
        input[type=radio] {
            width:20px;
            height:20px;
            vertical-align:middle;
            -webkit-appearance: none;
            margin:0 !important;
            border-radius:50%;
            background-image: url('../assets/images/nocheck.png');
            background-size:100% 100%
        }
        input[type=radio]:checked{
            background-image: url('../assets/images/checkout.png');
            background-size:100% 100%
        }
        .default{
            border:1px solid red !important;
        }
        .inputVal{
            position:absolute;
            height:30px;
        }
        .inputText{
            position:relative;
        }
        textarea{
            width: 800px;
            height: 180px;
            border: solid 1px #d0d0d0;
            vertical-align:top;
            text-indent:10px;
            font-family: MicrosoftYaHei;
            font-size: 14px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #333333;
        }
        .unit{
            position:relative;
            height:30px;
            margin-bottom:0px !important;
            vertiacl:middle;
            top:8px;
        }
        .unit input{
            position:absolute;
        }
        .unit span{
            position:absolute;
            left:80%;
        }
    </style>
</head>
<body>
<div>
    <%@ include file="../../breadline.jsp" %>
</div>
<div id="main" class="wrap">
    <div class="illness" style="width:99%; margin-right:19px;">
        <div class="tableWrap" style="padding-bottom:20px;background-color: #ffffff;box-shadow: 0 3px 7px 0 rgba(0, 0, 0, 0.05);">
            <div style="margin-left:20px;">
                <h3 style="margin-bottom:16px;font-size:20px;">病人基本档案</h3>
            </div>
            <div style="margin-left:19px;">
                <div class="way">
                    <span style="width:5px;padding-bottom:25px;background-color:#35acfd;display:inline-block;vertical-align:middle;margin-right:10px;"></span>
                    <span class="title">健康管理基础档案</span>
                    <button type="button" class="btn btn-info" @click="keep()" :disabled="saveDisabled">
                        <img src="../assets/images/revise.png" alt="" style="width:16px;vertical-align: middle;">  保存
                    </button>
                    <div class="way_content">
                        <div>
                            <label for="">姓名：</label>
                            <input type="text" v-model="bfData.realname" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入姓名">
                            <label for=""  style="margin-left:20px;">性别：</label>
                            <select name="sex" id="sex" v-model="bfData.sex">
                                <option value="男">男</option>
                                <option value="女">女</option>
                            </select>
                            <label for="" style="margin-left:20px;">年龄：</label>
                            <input type="text" v-model="bfData.age" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入年龄">
                        </div>
                        <div>
                            <label for="">出生日期：</label>
                            <div class="input-group date form_date" data-date-format="yyyy-mm-dd" style="display:inline-block !important;width:181px;margin-bottom:0px !important">
                                <input id="birthday" disabled="disabled" v-model="bfData.birthday" type="text" class="lay-date" readonly style="width:100%;" placeholder="请输入出生日期">
                            </div>
                            <label for=""  style="margin-left:20px;">民族：</label>
                            <input type="text" v-model="bfData.clan" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入民族">
                            <label for=""  style="margin-left:20px;">文化程度：</label>
                            <input type="text" v-model="bfData.education" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入文化程度">
                        </div>
                        <div>
                            <label for="">职业：</label>
                            <input type="text" v-model="bfData.career" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入职业">
                            <label for=""  style="margin-left:20px;">证件类型：</label>
                            <select name="" id="">
                                <option value="">身份证</option>
                            </select>
                            <label for=""  style="margin-left:20px;">证件号：</label>
                            <input disabled="disabled" type="text" v-model="bfData.idcard">
                        </div>
                        <div>
                            <label for="">户籍地：</label>
                            <input type="text" v-model="bfData.registeraddress" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入户籍所在地">
                            <label for="" style="margin-left:20px;">现住地：</label>
                            <input type="text" v-model="bfData.homeaddress" style="width:25%;" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入现住地">
                        </div>
                        <div>
                            <label for="">身高：</label>
                            <div style="display:inline-block;width:181px;" class="unit">
                                <input type="text" @blur="fun()" v-model="bfData.height" style="width:100%;" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入身高">
                                <span>cm</span>
                            </div>
                            <label for="" style="margin-left:20px;">体重：</label>
                            <div style="display:inline-block;width:181px;" class="unit">
                                <input type="text" @blur="fun()" v-model="bfData.weight" style="width:100%;" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入体重">
                                <span>kg</span>
                            </div>
                            <label for="" style="margin-left:20px;">BMI：</label>
                            <input type="text" v-model="BMI" onkeyup="this.value=this.value.replace(/\s+/g,'')" disabled="disabled">
                        </div>
                        <div>
                            <label for="">现患疾病诊断信息：</label>
                            <input type="text" v-model="bfData.diseaseDiagnosis" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入现患疾病诊断信息">
                            <label for="" style="margin-left:20px;">手机号：</label>
                            <input type="text" v-model="bfData.phone" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入手机号">
                        </div>
                        <div>
                            <label for="">建档医生：</label>
                            <input disabled="disabled" type="text" v-model="bfData.doctor">
                            <label for=""  style="margin-left:20px;">建档日期：</label>
                            <input disabled="disabled" type="text" v-model="bfData.createdtime">
                            <label for="" style="margin-left:20px;">建档机构：</label>
                            <input disabled="disabled" type="text" v-model="bfData.hospName" >
                        </div>
                        <div>
                            <label for="">编号：</label>
                            <input type="text" v-model="bfData.serialNumber" style="width:180px;" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入编号">
                            <label for=""  style="margin-left:20px;">特殊患者标记：</label>
                            <select name="sign" id="sign" v-model="bfData.sign">
                                <option value="">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <div>
                            <label for="">其他备注：</label>
                            <textarea name="" v-model="bfData.remark" id="" cols="30" rows="10" onkeyup="this.value=this.value.replace(/\s+/g,'')" placeholder="请输入其他备注信息"></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
    <script>
        var vm = new Vue({
            el : "#main",
            data: {
                bfData:{},
                BMI:'',
                saveDisabled:false
            },
            mounted(){
                initLayDate('#birthday');
                // 初始化获取idCard
                let [name,value] = location.search.split('?')[1].split('=')
                console.log(location.search)
                let that = this;
                that.bfData.card = value;
                // 初始化获取病人信息
                $.ajax({
                    url:"${URL_PATIENT_PATIENTINFO}",
                    type:'post',
                    dataType: "json",
                    data:{
                        idCard:that.bfData.card
                    },
                    success:function(data){
                        console.log(data)
                        that.bfData = data.data;
                        that.bfData.sign = that.isNull(that.bfData.sign);
                        that.bfData.createdtime =  that.bfData.createdTime.slice(0,10)
                        if( that.bfData.weight != '' && that.bfData.height != '' ){
                            if( that.bfData.weight == 0 || that.bfData.height == 0 ) {
                                that.BMI = 0
                            }else{
                                var Num = parseInt(that.bfData.height) * 0.01
                                that.BMI = parseInt(that.bfData.weight) / ( Num*Num );
                                that.BMI = that.BMI.toFixed(2);
                            }
                        } else{
                            that.BMI = ''
                        }
                    }
                })
            },
            methods: {
                fun(){
                    let that = this;
                    if( that.bfData.height != '' && that.bfData.weight != '' ){
                        var Num = parseInt(that.bfData.height) * 0.01
                        that.BMI = parseInt(that.bfData.weight) / ( Num*Num );
                        that.BMI = that.BMI.toFixed(2);
                    }
                },
                isNull(data){
                    if( data == null ){
                        data = ''
                    }
                    return data
                },
                keep(){
                    let that = this;
                    that.saveDisabled = true
                    $.ajax({
                        url : "${URL_PATIENT_UPDATEPATIENT}",
                        dataType:"json",
                        type:"post",
                        data:{
                            id:that.bfData.id,
                            idcard:that.bfData.idcard,
                            realname:that.bfData.realname,
                            education:that.bfData.education,
                            career:that.bfData.career,
                            clan:that.bfData.clan,
                            height:that.bfData.height,
                            weight:that.bfData.weight,
                            homeaddress:that.bfData.homeaddress,
                            registeraddress:that.bfData.registeraddress,
                            diseaseDiagnosis:that.bfData.diseaseDiagnosis,
                            serialNumber:that.bfData.serialNumber,
                            remark:that.bfData.remark,
                            sign:that.bfData.sign,
                            phone:that.bfData.phone
                        },
                        success:function( data ){
                            if(data.success){
                                $.ajax({
                                    url:"${URL_SCREENING_GETBREADLINE}",
                                    dataType:'json',
                                    type:'post',
                                    success:function(data){
                                        var urlLib = '';
                                        urlLib = JSON.parse(data.data).slice(0,urlLib.length-1)
                                        $.ajax({
                                            url:'${URL_SCREENING_SAVEBREADLINE}',
                                            data:{
                                                breadLine:JSON.stringify(urlLib)
                                            },
                                            dataType:'json',
                                            type:'post',
                                            success:function(data){
                                                parent.showSrc(urlLib[urlLib.length-1].href);
                                                // 刷新当前页面
                                                window.parent.simpleCloseModal();
                                            }
                                        })
                                    }
                                })
                            }else{
                                that.saveDisabled = false
                            }
                        }
                    })
                }
            }
        })
    </script>
</body>
</html>
